


        var flipLength = $('.headSwiper .palace:eq(0) .flip .picBox').length;
        var autoFlip = null;
        var opacityFlip = null;
        var scdStart = false;
        var fstCount = 0;
        var scdCount = 0;
        var newsPrevent = false;
        var newsIndex = 0;
        var canScrollDelay = 2600;

        
        $(document).ready(function(){
            
            if(!$('header nav.pc .menu a.current').length){
                if(sessionStorage.getItem('visitedHome') == null || window.performance.navigation.type == 1){
                    sessionStorage.setItem('visitedHome','true');
                    setTimeout(function(){
                        $('.letter').css('opacity','0');
                    },canScrollDelay);
                    setTimeout(function(){
                        $('body').addClass('canScroll');
                    },(canScrollDelay + 400));
                    setTimeout(function(){
                        $('.headSwiper').addClass('frozen');
                    },(canScrollDelay + 3000));
                }else{
                    $('body').addClass('canScroll');
                    $('.letter').css('display','none');
                    setTimeout(function(){
                        $('.headSwiper').addClass('frozen');
                    },3000);
                }
            }
            
            $('.picSwiper img:first-child').addClass('current noTsn');
            setTimeout(function(){
                $('.picSwiper img:first-child').removeClass('noTsn');
            },10);
            
            function flip(ele){
                var ind = ele.ind == undefined?0:ele.ind;
                ind++;
                ele.ind = ind;
                if(ind == flipLength){
                    ind = ele.ind = 0;
                }
                if(ele.parentNode.className.indexOf('contrary') >= 0){
                    ele.style.left = ind * 100 + '%';
                }else{
                    ele.style.left = '-' + (ind * 100) + '%';
                }
            }
            autoFlip = setInterval(function(){
                for(var f = 0;f < $('.headSwiper .palace>*').length;f++){
                    flip($('.headSwiper .palace>*')[f]);
                }
            },5000)

            opacityFlip = setInterval(function(){
                fstCount++;
                scdStart && (scdCount++);
                if(fstCount == 5 || scdCount == 5){
                    var odd = fstCount == 5?true:false;
                    for(var p = 0;p < $('.picSwiper').length;p++){
                        if((odd && p % 2 != 0) || (!odd && p % 2 == 0)) continue;
                        var ind = $('.picSwiper:eq(' + p + ')').find('.current').index();
                        var length = $('.picSwiper:eq(' + p + ') img').length;
                        $('.picSwiper')[p].current = ind;
                        $('.picSwiper:eq(' + p + ') img').removeClass('current');
                        ind++;
                        ind == length && (ind = 0);
                        $('.picSwiper:eq(' + p + ') img:eq(' + ind + ')').addClass('current');
                    }
                    fstCount == 5 &&(fstCount = 0);
                    scdCount == 5 &&(scdCount = 0);
                }
            },1000)
            setTimeout(function(){
                scdStart = true;
            },2000)

            $('main .news .contn .opacity img:first-child').addClass('active');
            $('main .news .contn .txt .item:first-child').addClass('active');
            $('main .news .contn .txt').addClass('border');
            function newsFlip(prv){
                if(newsPrevent)return false;
                var length = $('main .news .contn .opacity img').length;
                if(prv){
                    newsIndex--;
                    newsIndex < 0 && (newsIndex = length - 1);
                }else{
                    newsIndex++;
                    newsIndex == length && (newsIndex = 0);
                }
                $('main .news .contn .opacity img').removeClass('active');
                $('main .news .contn .opacity img:eq(' + newsIndex + ')').addClass('active');
                
                if(window.innerWidth >= 768){
                    $('main .news .contn .txt').addClass('hidden');
                    newsPrevent = true;
                    setTimeout(function(){
                        $('main .news .contn .txt').removeClass('border');
                        $('main .news .contn .txt .item').removeClass('active');
                        $('main .news .contn .txt .item:eq(' + newsIndex + ')').addClass('active');
                    },550)
                    setTimeout(function(){
                        $('main .news .contn .txt').removeClass('hidden');
                        $('main .news .contn .txt').addClass('border');
                        newsPrevent = false;
                    },700)
                }else{
                    $('main .news .contn .txt .item').removeClass('active');
                    $('main .news .contn .txt .item:eq(' + newsIndex + ')').addClass('active');
                }
                
            }
            $('main .news .contn .btn').click(function(){
                var prev = $(this)[0].className.indexOf('prev') >= 0?true:false;
                newsFlip(prev);
            })
            var max = 0;
            for(var ns = 0;ns < $('main .news .contn .txt .item').length;ns++){
                var thisH = $('main .news .contn .txt .item')[ns].offsetHeight;
                var maxH = $('main .news .contn .txt .item')[max].offsetHeight;
                if(thisH > maxH){
                    max = ns;
                }
            }
            $('main .news .contn .txt .item:eq(' + max + ')').addClass('max');
            $('main .news .contn .txt').addClass('complete')
            watchBrowse = setInterval(function(){
                if(window.innerWidth <= 1024){
                    var h = $('main .news .contn .txt .item.active')[0].offsetHeight;
                    $('main .news .contn .txt .box').css('height',h);
                }else{
                    $('main .news .contn .txt .box').css('height','');
                }
            },10)
        })

        